﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Site2 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
             if (Session["UserInfo"] == null)
            {
                labelLogin.Text = "未登录";
                btnLogin.Visible = true;
                btnLogout.Visible = false;
            }
            else
            {
                labelLogin.Text = "欢迎 " + ((Entity.UserInfo)Session["UserInfo"]).UserName;
                btnLogin.Visible = false;
                btnLogout.Visible = true;
            }
               
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Response.Redirect("Login.aspx");
        }
        protected void btnLogout_Click(object sender, EventArgs e)
        {
            Session.RemoveAll();
            Response.Redirect("~/Search.aspx");
        }
       
    }
}